//
//  PromptLoginDataSource.m
//  tcpoctest
//
//  Created by gump on 4/12/13.
//  Copyright (c) 2013 gump. All rights reserved.
//

#import "PromptLoginDataSource.h"

@implementation PromptLoginDataSource

-(id)init
{
    self = [super init];
    if(self != nil)
    {
        bshowmain = false;
        bpromptlogin = false;
        bInitData = true;
        pthread_mutex_init(&mutexprompt, 0);
    }
    
    return self;
}

-(void)SetIsShowMain:(bool)bshow
{
    pthread_mutex_lock(&mutexprompt);
    
    bshowmain = bshow;
    
    pthread_mutex_unlock(&mutexprompt);
}

-(bool)IsShowMain
{
    bool b = false;
    
    pthread_mutex_lock(&mutexprompt);
    
    b = bshowmain;
    
    pthread_mutex_unlock(&mutexprompt);
    
    return b;
}

-(void)SetIsPromptLogin:(bool)bprompt
{
    pthread_mutex_lock(&mutexprompt);
    
    bpromptlogin = bprompt;
    
    pthread_mutex_unlock(&mutexprompt);
}

-(bool)ISPromptLogin
{
    bool b = false;
    
    pthread_mutex_lock(&mutexprompt);
    
    b = bpromptlogin;
    
    pthread_mutex_unlock(&mutexprompt);
    
    return b;
}

-(void)SetIsInitData:(bool)binit
{
    pthread_mutex_lock(&mutexprompt);
    
    bInitData = binit;
    
    pthread_mutex_unlock(&mutexprompt);
}

-(bool)IsInitData
{
    bool b = true;
    
    pthread_mutex_lock(&mutexprompt);
    
    b = bInitData;
    
    pthread_mutex_unlock(&mutexprompt);
    
    return b;
}

@end
